<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script src="./js/jquery.min.js" charset="utf-8"></script>
    <script src="./js/utils.js" charset="utf-8"></script>
    <script src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <blockquote class="layui-elem-quote">欢迎使用本系统!
                        当前班次为:
                        <span id="workShift"></span>
                        上一班次为:
                        <span id="lastWorkShift"></span>
                    </blockquote>
                </div>
            </div>
        </div>
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">上一班次交接记录</div>
                <div class="layui-card-body ">
                    <ul class="layui-row layui-col-space10 layui-this x-admin-carousel x-admin-backlog">
                        <li class="layui-col-md3 layui-col-xs6">
                            <a id="VisualInspectionHref" href="javascript:;" class="x-admin-backlog-body">
                                <h3>目检</h3>
                                <p>
                                    <cite id="VisualInspection">未完成</cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md3 layui-col-xs6">
                            <a id="ThicknessHref" href="javascript:;" class="x-admin-backlog-body">
                                <h3>厚度</h3>
                                <p>
                                    <cite id="Thickness">未完成</cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md3 layui-col-xs6">
                            <a id="ResistivityHref" href="javascript:;" class="x-admin-backlog-body">
                                <h3>电阻率</h3>
                                <p>
                                    <cite id="Resistivity">未完成</cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md3 layui-col-xs6">
                            <a id="ParticlesHref" href="javascript:;" class="x-admin-backlog-body">
                                <h3>颗粒</h3>
                                <p>
                                    <cite id="Particles">未完成</cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md3 layui-col-xs6">
                            <a id="PutOnShelfHref" href="javascript:;" class="x-admin-backlog-body">
                                <h3>成品上架</h3>
                                <p>
                                    <cite id="PutOnShelf">未完成</cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md3 layui-col-xs6 ">
                            <a id="FinalInspectionHref" href="javascript:;" class="x-admin-backlog-body">
                                <h3>终检</h3>
                                <p>
                                    <cite id="FinalInspection">未完成</cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md6 layui-col-xs6 ">
                            <a id="MonitorHref" href="javascript:;" class="x-admin-backlog-body">
                                <h3>班长</h3>
                                <p>
                                    <cite id="Monitor">未完成</cite></p>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <!--        <div class="layui-col-md12">-->
        <!--            <div class="layui-card">-->
        <!--                <div class="layui-card-header">当前班次注意事项</div>-->
        <!--                <div class="layui-card-body ">-->
        <!--                    <table class="layui-table">-->
        <!--                        <tbody>-->
        <!--                        <tr>-->
        <!--                            <th>xxx版本</th>-->
        <!--                            <td>1.0.180420</td>-->
        <!--                        </tr>-->
        <!--                        <tr>-->
        <!--                            <th>服务器地址</th>-->
        <!--                            <td>x.xuebingsi.com</td>-->
        <!--                        </tr>-->
        <!--                        <tr>-->
        <!--                            <th>操作系统</th>-->
        <!--                            <td>WINNT</td>-->
        <!--                        </tr>-->
        <!--                        <tr>-->
        <!--                            <th>运行环境</th>-->
        <!--                            <td>Apache/2.4.23 (Win32) OpenSSL/1.0.2j mod_fcgid/2.3.9</td>-->
        <!--                        </tr>-->
        <!--                        <tr>-->
        <!--                            <th>PHP版本</th>-->
        <!--                            <td>5.6.27</td>-->
        <!--                        </tr>-->
        <!--                        <tr>-->
        <!--                            <th>PHP运行方式</th>-->
        <!--                            <td>cgi-fcgi</td>-->
        <!--                        </tr>-->
        <!--                        <tr>-->
        <!--                            <th>MYSQL版本</th>-->
        <!--                            <td>5.5.53</td>-->
        <!--                        </tr>-->
        <!--                        <tr>-->
        <!--                            <th>ThinkPHP</th>-->
        <!--                            <td>5.0.18</td>-->
        <!--                        </tr>-->
        <!--                        <tr>-->
        <!--                            <th>上传附件限制</th>-->
        <!--                            <td>2M</td>-->
        <!--                        </tr>-->
        <!--                        <tr>-->
        <!--                            <th>执行时间限制</th>-->
        <!--                            <td>30s</td>-->
        <!--                        </tr>-->
        <!--                        <tr>-->
        <!--                            <th>剩余空间</th>-->
        <!--                            <td>86015.2M</td>-->
        <!--                        </tr>-->
        <!--                        </tbody>-->
        <!--                    </table>-->
        <!--                </div>-->
        <!--            </div>-->
        <!--        </div>-->
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">开发团队</div>
                <div class="layui-card-body ">
                    <table class="layui-table">
                        <tbody>
                        <tr>
                            <th>开发者</th>
                            <td>李天奕(litianyi)</td>
                        </tr>
                        <tr>
                            <th>联系方式</th>
                            <td>work_litianyi@163.com</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <style id="welcome_style"></style>
        <div class="layui-col-md12">
            <blockquote class="layui-elem-quote layui-quote-nm">
                版权所有 ©2021 河北普兴电子科技股份有限公司 All rights reserved.
            </blockquote>
        </div>
    </div>
</div>
</div>
</body>
<script>
    window.onload = function () {
        getWorkingShift();
        $("#lastWorkShift").text(getLastWorkShift());
        checkRecord();
    };

    function getWorkingShift() {
        var myTime = new Date().getHours();
        if (myTime <= 8) { //返回上一天夜班
            str = getLastDate() + " 夜班";
            $("#workShift").text(str);
        } else if (myTime >= 19) { //返回当天夜班
            str = getDate() + " 夜班";
            $("#workShift").text(str);
        } else { //返回当天日班
            str = getDate() + " 日班";
            $("#workShift").text(str);
        }
    }

    function getLastWorkShift() {
        var myDate = new Date();
        var myTime = myDate.getHours();
        var str = "";
        if (myTime <= 8) { //返回上一天日班
            str = getLastDate() + " 日班";
        } else if (myTime >= 19) { //返回当天日班
            str = getDate() + " 日班";
        } else { //返回上一天夜班
            str = getLastDate() + " 夜班";
        }
        return str;
    }

    function checkRecord() {
        var myTime = new Date().getHours();
        var date, workingshift;
        if (myTime <= 8) { //返回上一天日班
            date = getLastDate();
            workingshift = "0";
        } else if (myTime >= 19) { //返回当天日班
            date = getDate();
            workingshift = "0";
        } else { //返回上一天夜班
            date = getLastDate();
            workingshift = "1";
        }
        $.ajax({
            type: "get",
            url: "/checkRecord",
            data: {
                date: date,
                workingshift: workingshift
            },
            dataType: "json",
            success: function (data) {
                console.log(data);
                for (let key in data) {
                    $("#" + key).text("完成");
                    switch (key) {
                        case 'VisualInspection':
                            var VisualInspectionProcess = '目检记录' + date;
                            var VisualInspectionHref = "./normal-record-detail.html?uuid=" + data[key].uuid + "&process=" + data[key].process + "&date=" + data[key].workingshiftdate + "&workingShift=" + data[key].workingshift;
                            $("#VisualInspectionHref").attr('href', 'javascript:xadmin.open(\'' + VisualInspectionProcess + '\', \'' + VisualInspectionHref + '\', 100, 700, true)');
                            break;
                        case 'Thickness':
                            var ThicknessProcess = '厚度记录' + date;
                            var ThicknessHref = "./normal-record-detail.html?uuid=" + data[key].uuid + "&process=" + data[key].process + "&date=" + data[key].workingshiftdate + "&workingShift=" + data[key].workingshift;
                            $("#ThicknessHref").attr('href', 'javascript:xadmin.open(\'' + ThicknessProcess + '\', \'' + ThicknessHref + '\', 100, 700, true)');
                            break;
                        case 'Resistivity':
                            var ResistivityProcess = '电阻率记录' + date;
                            var ResistivityHref = "./normal-record-detail.html?uuid=" + data[key].uuid + "&process=" + data[key].process + "&date=" + data[key].workingshiftdate + "&workingShift=" + data[key].workingshift;
                            $("#ResistivityHref").attr('href', 'javascript:xadmin.open(\'' + ResistivityProcess + '\', \'' + ResistivityHref + '\', 100, 700, true)');
                            break;
                        case 'Particles':
                            var ParticlesProcess = '颗粒记录' + date;
                            var ParticlesHref = "./normal-record-detail.html?uuid=" + data[key].uuid + "&process=" + data[key].process + "&date=" + data[key].workingshiftdate + "&workingShift=" + data[key].workingshift;
                            $("#ParticlesHref").attr('href', 'javascript:xadmin.open(\'' + ParticlesProcess + '\', \'' + ParticlesHref + '\', 100, 700, true)');
                            break;
                        case 'PutOnShelf':
                            var PutOnShelfProcess = '成品上架记录' + date;
                            var PutOnShelfHref = "./normal-record-detail.html?uuid=" + data[key].uuid + "&process=" + data[key].process + "&date=" + data[key].workingshiftdate + "&workingShift=" + data[key].workingshift;
                            $("#PutOnShelfHref").attr('href', 'javascript:xadmin.open(\'' + PutOnShelfProcess + '\', \'' + PutOnShelfHref + '\', 100, 700, true)');
                            break;
                        case 'FinalInspection':
                            var FinalInspectionProcess = '终检记录' + date;
                            var FinalInspectionHref = "./normal-record-detail.html?uuid=" + data[key].uuid + "&process=" + data[key].process + "&date=" + data[key].workingshiftdate + "&workingShift=" + data[key].workingshift;
                            $("#FinalInspectionHref").attr('href', 'javascript:xadmin.open(\'' + FinalInspectionProcess + '\', \'' + FinalInspectionHref + '\', 100, 700, true)');
                            break;
                        case 'Monitor':
                            var MonitorProcess = '班长记录' + date;
                            var MonitorHref = "./monitor-record-detail.html?uuid=" + data[key].uuid + "&process=" + data[key].process + "&date=" + data[key].workingshiftdate + "&workingShift=" + data[key].workingshift;
                            $("#MonitorHref").attr('href', 'javascript:xadmin.open(\'' + MonitorProcess + '\', \'' + MonitorHref + '\', 100, 700, true)');
                            break;
                    }
                }
            }
        });
    }
</script>
</html>